home *** CD-ROM | disk | FTP | other *** search
/ Delphi 2.0 - Programmer's Utilities Power Pack / Delphi 2.0 Programmer's Utilities Power Pack.iso / m_to_r / prtrep41 / demo2.pa_ / demo2.bin
Encoding:
Text File  |  1996-09-15  |  1.6 KB  |  73 lines

  1. unit Demo2;
  2.  
  3. interface
  4.  
  5. uses
  6.   SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
  7.   StdCtrls, Forms, DBCtrls, DB, DBGrids, Buttons, DBTables, Grids,
  8.   ExtCtrls, Printers, PrnGridR, PrnFile;
  9.  
  10. type
  11.   TDemo2Form = class(TForm)
  12.     DBGrid1: TDBGrid;
  13.     Panel1: TPanel;
  14.     DataSource1: TDataSource;
  15.     Panel2: TPanel;
  16.     Query1: TQuery;
  17.     Query1CustNo: TFloatField;
  18.     Query1Company: TStringField;
  19.     Query1Country: TStringField;
  20.     Query1Phone: TStringField;
  21.     Query1Contact: TStringField;
  22.     Previews: TBitBtn;
  23.     Exit: TBitBtn;
  24.     Preview: TBitBtn;
  25.     Query1LastInvoiceDate: TDateTimeField;
  26.     PrintGridReport1: TPrintGridReport;
  27.     Memo1: TMemo;
  28.     PrintFile1: TPrintFile;
  29.     procedure FormCreate(Sender: TObject);
  30.     procedure PreviewClick(Sender: TObject);
  31.     procedure PreviewsClick(Sender: TObject);
  32.     procedure ExitClick(Sender: TObject);
  33.   private
  34.     { private declarations }
  35.   public
  36.   end;
  37.  
  38. var
  39.   Demo2Form: TDemo2Form;
  40.  
  41. implementation
  42.  
  43. {$R *.DFM}
  44.  
  45. procedure TDemo2Form.FormCreate(Sender: TObject);
  46. begin
  47.   Query1.Open;
  48.  
  49.   { When printing subtotals - Use field COUNTRY }
  50.   PrintGridReport1.SetSubTotalField(1, 'COUNTRY');
  51. end;
  52.  
  53. procedure TDemo2Form.PreviewClick(Sender: TObject);
  54. begin
  55.     PrintGridReport1.PrintSubTotals := False;
  56.   PrintGridReport1.ViewBkColor := clBlue;
  57.     PrintGridReport1.Execute;
  58. end;
  59.  
  60. procedure TDemo2Form.PreviewsClick(Sender: TObject);
  61. begin
  62.     PrintGridReport1.PrintSubTotals := True;
  63.   PrintGridReport1.ViewBkColor := clMaroon;
  64.     PrintGridReport1.Execute;
  65. end;
  66.  
  67. procedure TDemo2Form.ExitClick(Sender: TObject);
  68. begin
  69.     Close;
  70. end;
  71.  
  72. end.
  73.